<script lang='ts' setup>


import { ref } from 'vue';
import SubSoftware from '../SubSoftware.vue';

const props = defineProps([
    'encrypt'
])

const emit = defineEmits(['updateEncrypt'])

const open = ref<{
    show: boolean,
    code: string,
    item: {
        key: keyof typeof props.encrypt.value;
        value: string
    }
}>({
    show: false,
    code: "",
    item: {
        key: "interior",
        value: "111111111"
    }
});


const verify = (item: typeof open.value.item) => {
    open.value.show = true
    open.value.item = item
};


const showSubSoftware = ref(false)

const handleOk = () => {

}
</script>
<template>
    <a-descriptions bordered>
        <a-descriptions-item label="公网数据加密串" :span="4">
            <div class="flex items-center">
                <span class="w-90">
                    {{ encrypt.interior }}
                </span>
                <a-button type="link" @click="verify({
                    key: 'interior', value: '123456789123'
                })">
                    查看
                </a-button>
                <img src="/console/copy.png" alt="" class="w-5 h-5 cursor-pointer copy1"
                    :data-clipboard-text="encrypt.interior">
            </div>
        </a-descriptions-item>
        <a-descriptions-item label="内网数据加密串" :span="4">
            <div class="flex items-center">
                <span class="w-90">
                    {{ encrypt.exterior }}
                </span>
                <a-button type="link" @click="verify({
                    key: 'exterior', value: '123456789123'
                })">
                    查看
                </a-button>
                <img src="/console/copy.png" alt="" class="w-5 h-5 cursor-pointer copy2"
                    :data-clipboard-text="encrypt.exterior">
            </div>
        </a-descriptions-item>

        <a-descriptions-item label="平台信息管理" :span="1">
            <a-button type="primary" @click="showSubSoftware = true">查看</a-button>
        </a-descriptions-item>
    </a-descriptions>



    <SubSoftware :show-sub-soft="showSubSoftware" @close="showSubSoftware = false" />

    <a-modal v-model:open="open.show" title="验证码" centered :footer="null">
        <div class="flex justify-around items-center mt-5 mb-5 px-8">
            <a-input class="w-60 h-8" v-model:value="open.code" />
            <img src="/common/code.jpg" alt="" class="w-30 h-8 cursor-pointer">
        </div>

        <div class="flex justify-around px-30">
            <a-button type="primary" @click="handleOk">
                确定
            </a-button>
            <a-button @click="open.show = false">
                取消
            </a-button>
        </div>
    </a-modal>





</template>
<style lang='scss' scoped></style>